package com.zd.escortaction.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.zd.escortaction.domain.EscortAction;
import com.zd.escortaction.mapper.EscortActionMapper;
import com.zd.escortaction.service.IEscortActionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 护送人员操作动作记录Service业务层处理
 * 
 * @author fxiao
 * @date 2020-08-11
 */
@Service
public class EscortActionServiceImpl implements IEscortActionService
{
    private final Logger log= LoggerFactory.getLogger(this.getClass());
    @Autowired
    private EscortActionMapper escortActionMapper;

    /**
     * 查询护送人员操作动作记录
     * 
     * @param id 护送人员操作动作记录ID
     * @return 护送人员操作动作记录
     */
    @Override
    public EscortAction selectEscortActionById(String id)
    {
        return escortActionMapper.selectEscortActionById(id);
    }

    /**
     * 查询护送人员操作动作记录列表
     * 
     * @param escortAction 护送人员操作动作记录
     * @return 护送人员操作动作记录
     */
    @Override
    public List<EscortAction> selectEscortActionList(EscortAction escortAction)
    {
        return escortActionMapper.selectEscortActionList(escortAction);
    }

    /**
     * 新增护送人员操作动作记录
     * 
     * @param escortAction 护送人员操作动作记录
     * @return 结果
     */
    @Override
    public int insertEscortAction(EscortAction escortAction)
    {
        if(escortAction.getCwlx()==null){
            log.error("com.zd.escortaction.domain.EscortAction.cwlx不能为null");
            throw  new RuntimeException("com.zd.escortaction.domain.EscortAction.cwlx不能为null");
        }
        return escortActionMapper.insertEscortAction(escortAction);
    }

    /**
     * 修改护送人员操作动作记录
     * 
     * @param escortAction 护送人员操作动作记录
     * @return 结果
     */
    @Override
    public int updateEscortAction(EscortAction escortAction)
    {
        if(escortAction.getCwlx()==null){
            log.error("com.zd.escortaction.domain.EscortAction.cwlx不能为null");
            throw  new RuntimeException("com.zd.escortaction.domain.EscortAction.cwlx不能为null");
        }
        return escortActionMapper.updateEscortAction(escortAction);
    }

    /**
     * 删除护送人员操作动作记录对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteEscortActionByIds(String ids)
    {
        return escortActionMapper.deleteEscortActionByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除护送人员操作动作记录信息
     * 
     * @param id 护送人员操作动作记录ID
     * @return 结果
     */
    @Override
    public int deleteEscortActionById(String id)
    {
        return escortActionMapper.deleteEscortActionById(id);
    }
}
